# -*- coding: utf-8 -*-
from sqlalchemy import Column,String,Integer,Text,Binary,Boolean,DateTime,Enum,Float,BigInteger
from adminApp.extensions import db
from .base import BaseModel
import uuid


def gen_id():
    return uuid.uuid4().hex


class BandWidthHistoryPic(BaseModel, db.Model):
    '''带宽速率数据 历史图'''
    # 接收带宽 单位MB/秒
    nic_rx = Column(Float)
    # 发送带宽 单位MB/秒
    nic_tx = Column(Float)
    # 时间
    nic_time = Column(DateTime, index=True)

    machine_id = db.Column(db.Integer, db.ForeignKey('machine.id', ondelete='CASCADE'), nullable=False, index=True)
    machine = db.relationship('Machine', back_populates='bandwidthhistorypics')